package com.peng;

public class TankTankCollider implements Collider {
    @Override
    public boolean collide(GameObject g1, GameObject g2) {
        if (g1 instanceof Tank && g2 instanceof Tank) {
            Tank tank1 = (Tank) g1;
            Tank tank2 = (Tank) g2;
            if (tank1.getRectangle().intersects(tank2.getRectangle())) {
                tank1.reverseDir();
                tank2.reverseDir();

            }
        }
        return false;
    }
}
